import { Entity, Column, PrimaryGeneratedColumn, ManyToOne, CreateDateColumn } from 'typeorm';

import { User } from "src/modules/user/entities/user.entity";
import { Article } from '../../article/entities/article.entity';
@Entity()
export class Comment {
  @PrimaryGeneratedColumn("uuid")
  commentid: string;

  @ManyToOne(() => User, user => user.comments)
  user: User;

  @ManyToOne(() => Article, article => article.comments)
  article: Article;

  @Column()
  content: string;
  @Column({ default: 0 })
  like: number;
  @Column({ default: 0 })
  unlike: number;
  @CreateDateColumn({
    type: 'timestamp'
  })
  create_time: Date
}

